package com.rui.sideup.test.udpinfo;

import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * @author ZhangRui
 * @date 2023/03/28 16:11
 **/
public class UdpClient {

    public static void main(String[] args) throws IOException {
        System.out.println("客户端");
        // 创建客户端对象
        Socket socket = new Socket("127.0.0.1", 7771);
        // 创建低级输出流并转高级
        PrintStream ps = new PrintStream(socket.getOutputStream());

        // 创建输入
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请说：");
            ps.println(sc.nextLine());
            // 刷新
            ps.flush();
        }

    }

}
